
import React from 'react';
import Controller from "Controller";

/** 获取选中的对象 */
export function useElement() {
    const threeController = Controller.instance.useMemo(s => s.threeController, [])

    const selectedElementUuid = threeController.useMemo(s=>s.selectedElementUuid, []);

    const elementMap = threeController.useMemo(s=>s.elementMap, []);

    const element = React.useMemo(() => selectedElementUuid ? elementMap.get(selectedElementUuid) : undefined, [elementMap, selectedElementUuid])

    return {
        element
    }
}